import crypto from 'crypto';
const encrypt = (data, key) => {
  let encrypted = '';
  const cip = crypto.createCipher('aes-128-ecb', key);
  encrypted += cip.update(data, 'utf-8', 'hex');
  encrypted += cip.final('hex');
  return encrypted;
};

const decrypt = (data, key) => {
  let decrypted = '';
  const decipher = crypto.createDecipher('aes-128-ecb', key);
  decrypted += decipher.update(data, 'hex', 'utf-8');
  decrypted += decipher.final('utf-8');
  return decrypted;
};

export default {
  encrypt,
  decrypt,
};

